Skip to main content

All Questions

Tagged with
9votes
3answers
573views

Parsing SFV files to extract and store the hashes

Similar to the class for the RAR file, now a class to extract and store the hashes from SFV files. Though this was considerably easier, there has been some code reorganisation: there is now an ...
viuser's user avatar
1vote
1answer
219views

Python3 currency abstract class (without the permission to be instantiated directly)

I'm a newbie python developer who accidentally studied the concept of Abstract classes and I found it pretty much helpful to implement due to the SOLID principles. At the very moment of testing and ...
KhodeNima's user avatar
1vote
1answer
72views

Python 3.10+: an exploration of meta classes and subclasses through the lens of metric (SI) prefixes with subclass-able units and changeable bases

Problem Statement From the National Institute of Standards and Technology's Office of Weights and Measures, one can find a handy list of all the metric prefixes: e.g. Purpose Name Symbol Factor Name ...
SumNeuron's user avatar
2votes
0answers
124views

A Python base class for a family of Postgres server manager classes

I'm working on a repo the purpose of which is to create and manage a local PostGIS server. (PostGIS is a bit niche, but it boils down to a few extra spatial data types and built-in SQL function. With ...
Tom Hosker's user avatar
3votes
0answers
114views

Build the Mountain Car Environment using coupled inheritance and type annotations

This code builds the environment for the standard Mountain Car Problem of reinforcement learning. I'm using Python 3.9 with PyCharm and I'm wishing to use type annotations throughout. I'm trying to ...
Robin Carter's user avatar
1vote
0answers
61views

How was this python code analyze these classes with class diagram

Anyone please review my code and give some improvement suggestions. I wrote code but not to the best standards. I think this site give some valuable suggestions this code is for extracting xlsx or csv ...
Mohanraj M's user avatar
3votes
2answers
460views

Alarm clock subclass of a clock

I have these two classes and they should remain separate classes, but I have a feeling that this could be implemented more efficiently and with less duplicate code. After googling around I still didn'...
LostHat's user avatar
1vote
2answers
3kviews

Ensuring that attributes referenced by a mixin are present in the children class

I have implemented the below _get_schema method to ensure that schema attribute is always present on the ...
barciewicz's user avatar
32votes
5answers
5kviews

Chess game for my students

I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins. I wrote this code as an example, and I want to be sure it is as good as possible before I release ...
Infinity's user avatar
-2votes
2answers
92views

Multiple inheritance of class broken up into modules [closed]

I have a class Main that uses fn(cls, ...) methods from several modules; they're used exclusively by ...
OverLordGoldDragon's user avatar
2votes
1answer
101views

Dynamic module import in a class hierarchy

I have two python libraries, let's call them lib and extended_lib, that provide a very similar public API. To be more specific, <...
Patrick Trentin's user avatar
2votes
1answer
167views

Read data from file: better approach using OOP

Suggestions to better understand when and how is convenient to use OPP. This question is a follow-up question on this post. I have a script that reads an input file. In time, the script may be ...
Stefano's user avatar
1vote
1answer
167views

OOP paradigm in python - Extend class functionalities

I am a novice of Python and I am trying to understand how to use OOP paradigm to improve my scripts. My scripts usually read some data from a formatted csv file and perform some numerical analysis. ...
Stefano's user avatar
4votes
1answer
158views

Using composition instead of inheritance and abstract classes

I have a tool that displays data in some format. For example, it can display a list of dogs in a CSV or JSON formats. In the code, I had a lot of places where I had to check the format and display ...
vesii's user avatar
4votes
0answers
108views

Inherit docstrings from specified parent

I was recently working on some python where I was working with multiple inheritance and mixins and stuff like that, and I wanted to inherit docstrings for specific functions, from specific parents (...
Andrew's user avatar

153050per page
close